/**
 * 
 */
package com.fbty.mt.service.impl;

import java.util.List;

import com.fbty.base.dao.MtJdbcDao;
import com.fbty.mt.dao.IpItemDao;
import com.fbty.mt.dao.OnlyIpInfoDao;
import com.fbty.mt.domain.IpItem;
import com.fbty.mt.service.IpItemService;

/**
 * @author admin
 *
 */
public class IpItemServiceImpl implements IpItemService {
	
	private IpItemDao ipItemDao;
	private MtJdbcDao mtJdbcDao;
	
	public void setMtJdbcDao(MtJdbcDao mtJdbcDao) {
		this.mtJdbcDao = mtJdbcDao;
	}
	
	
	
	public void setIpItemDao(IpItemDao ipItemDao) {
		this.ipItemDao = ipItemDao;
	}
	
	

	/* (non-Javadoc)
	 * @see com.fbty.mt.service.IpItemService#save(com.fbty.mt.domain.IpItem)
	 */
	@Override
	public void save(IpItem ipItem) {
		// TODO Auto-generated method stub

	}

	/* (non-Javadoc)
	 * @see com.fbty.mt.service.IpItemService#saveBach(java.util.List)
	 */
	@Override
	public void saveBach(List<IpItem> ipItems) {
		
		String st="";
		
		for(int i=0;i<ipItems.size();i++){
			st +="'"+ipItems.get(i).getOnlyIp()+"'";
			if(i<ipItems.size()-1){
				st +=",";
			}
		}
		
		mtJdbcDao.getMysqlJdbcTemplate().update("update tab_only_ip_info o set o.state =2  where o.exportIp in ("+st+")");
		
		ipItemDao.saveAll(ipItems);
	}

}
